package com.yuyou.fn.platform.service.impl;

import org.springframework.stereotype.Service;

import com.yuyou.fn.platform.mapper.DistrictMapper;
import com.yuyou.fn.platform.entity.District;
import com.yuyou.fn.platform.service.IDistrictService;
import com.github.wens.framework.service.impl.SuperServiceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * District 表数据服务层接口实现类
 *
 */
@Service
public class DistrictServiceImpl extends SuperServiceImpl<DistrictMapper, District,Long> implements IDistrictService {

    @Override
    public Map<String, District> findAllMapByProvinceCityDistrictName() {
        Map<String,District> districtMap=new HashMap<>();
        List<District> districtList = this.findListByExample(District.createExample());
        if (districtList!=null){
            for (District district:districtList){
                String key=district.getProvinceName().replaceAll("省","")+"_"+district.getCityName().replaceAll("市","")+"_"+district.getDistrictName();
                districtMap.put(key,district);
            }
        }
        return districtMap;
    }
}